home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / tex / files / !tex / TeXsource / beebe / h / reldfont < prev    next >
Encoding:
Text File  |  1990-12-18  |  2.8 KB  |  102 lines

  1. /* -*-C-*- reldfont.h */
  2. /*-->reldfont*/
  3. /**********************************************************************/
  4. /****************************** reldfont ******************************/
  5. /**********************************************************************/
  6.  
  7. void
  8. #ifdef __STDC__
  9. reldfont(struct font_entry *tfontptr)
  10. #else
  11. reldfont(tfontptr)        /* load (or reload) font parameters */
  12. struct font_entry *tfontptr;
  13. #endif
  14. {
  15.     register UNSIGN16 the_char;    /* loop index */
  16.     int err_code;
  17.     register struct char_entry *tcharptr;/* temporary char_entry pointer */
  18.  
  19.     tfontptr->font_mag = (UNSIGN32)((actfact(
  20.         MAGSIZE((float)tfontptr->s/(float)tfontptr->d)) *
  21.     ((float)runmag/(float)STDMAG) *
  22.  
  23. #if    USEGLOBALMAG
  24.     actfact(mag) *
  25. #endif
  26.  
  27.     (float)RESOLUTION * 5.0) + 0.5);
  28.  
  29.     tfontptr->designsize = (UNSIGN32)0L;
  30.     tfontptr->hppp = (UNSIGN32)0L;
  31.     tfontptr->vppp = (UNSIGN32)0L;
  32.     tfontptr->min_m = (INT32)0L;
  33.     tfontptr->max_m = (INT32)0L;
  34.     tfontptr->min_n = (INT32)0L;
  35.     tfontptr->max_n = (INT32)0L;
  36.  
  37.     for (the_char = FIRSTPXLCHAR; the_char <= LASTPXLCHAR; the_char++)
  38.     {
  39.     tcharptr = &(tfontptr->ch[the_char]);
  40.     tcharptr->dx = (INT32)0L;
  41.     tcharptr->dy = (INT32)0L;
  42.     tcharptr->hp = (COORDINATE)0;
  43.     tcharptr->fontrp = -1L;
  44.     tcharptr->pxlw = (UNSIGN16)0;
  45.     tcharptr->rasters = (UNSIGN32*)NULL;
  46.     tcharptr->refcount = 0;
  47.     tcharptr->tfmw = 0L;
  48.     tcharptr->wp = (COORDINATE)0;
  49.     tcharptr->xoffp = (COORDINATE)0;
  50.     tcharptr->yoffp = (COORDINATE)0;
  51.     }
  52.  
  53.     if (tfontptr != pfontptr)
  54.     (void)openfont(tfontptr->n);
  55.  
  56.     if (fontfp == (FILE *)NULL)    /* have empty font with zero metrics */
  57.     return;
  58.  
  59.     for (;;)        /* fake one-trip loop */
  60.     {    /* test for font types PK, GF, and PXL in order of preference */
  61.         (void)REWIND(fontfp);    /* position to beginning-of-file */
  62.         if ( ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)PKPRE) &&
  63.             ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)PKID) )
  64.         {
  65.             tfontptr->font_type = (BYTE)FT_PK;
  66.         tfontptr->charxx = (void(*)())charpk;
  67.             err_code = readpk();
  68.         break;
  69.         }
  70.  
  71.         (void)REWIND(fontfp);    /* position to beginning-of-file */
  72.         if ( ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)GFPRE) &&
  73.         ((BYTE)nosignex(fontfp,(BYTE)1) == (BYTE)GFID) )
  74.         {
  75.         tfontptr->font_type = (BYTE)FT_GF;
  76.         tfontptr->charxx = (void(*)())chargf;
  77.         err_code = readgf();
  78.         break;
  79.         }
  80.  
  81.     (void)REWIND(fontfp);    /* position to beginning-of-file */
  82.     if (nosignex(fontfp,(BYTE)4) == (UNSIGN32)PXLID)
  83.     {
  84.         tfontptr->font_type = (BYTE)FT_PXL;
  85.         tfontptr->charxx = (void(*)())charpxl;
  86.         err_code = readpxl();
  87.         break;
  88.     }
  89.  
  90.     err_code = (int)EOF;
  91.     break;
  92.     } /* end one-trip loop */
  93.  
  94.     if (err_code)
  95.     {
  96.         (void)sprintf(message,
  97.         "reldfont():  Font file [%s] is not a valid GF, PK, or PXL file",
  98.         tfontptr->name);
  99.         (void)fatal(message);
  100.     }
  101. }
  102.